package com.itheima.project.vo.search;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author mrchen
 * @date 2022/3/27 19:45
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PageParam {
    /**
     * 起始偏移量
     */
    private Integer from;
    /**
     * 每页显示条数
     */
    private Integer size;
    /**
     * 第几页
     */
    private Integer page;
    public static PageParam of(Integer page,Integer size){
        PageParam pageParam = new PageParam();
        pageParam.from = (page  - 1) * size;
        pageParam.size = size;
        pageParam.page = page;
        return pageParam;
    }
}
